    ***************************
    * do Prepare_table_linear_model.do
    ***************************

    ***************************
    * INITIALIZE
    ***************************

clear all
set more off

    ***************************
    * LOAD DATA
    ***************************

use data_BHP2, clear

    ***************************
    * QUANTILE REGRESSIONS
    ***************************

foreach tt in 0.25 0.50 0.75 {

    di ""
    di "tau=`tt'"
    di ""

    local tau100=`tt'*100

    qreg log_q log_p log_y, q(`tt') nolog

    estadd ysumm, mean sd
  
    est store qreg`tau100'
    
}

    ***************************
    * LINEAR REGRESSION
    ***************************

reg log_q log_p log_y 
estadd ysumm, mean sd

est store reg 

    ***************************
    * DISPLAY TABLE 3
    ***************************

estout qreg* reg using ./table_3.txt, cells (b(fmt(%8.2f)) se(fmt(%8.2f) par([ ])) ) starlevels(* 0.1 ** 0.05 *** 0.01) stats(N, fmt(%6.0f %6.3f %6.3f)) noabbrev notype replace prehead("$S_DATE $S_TIME" "") rename(_cons Constant log_p "log(p)" log_y "log(y)") mlabels("alpha=0.25" "alpha=0.50" "alpha=0.75" "OLS") style(fixed)

    ***************************
    * PREPARE TABLE 1
    ***************************

qui estpost summarize log_q log_p log_y

esttab . using ./table_1.txt, cells("mean(fmt(%7.3f)) sd") replace

    *

    
